import 'package:fluent_ui/fluent_ui.dart';
import 'package:jm_flutter/jm_flutter.dart';

import '../my_text.dart';
import '../widget.dart';

class MyBigButton extends StatelessWidget {
  final VoidCallback onPressed;
  final Widget? child;
  final String text;
  final double size;
  final Color? textColor;
  final Color? color;
  final bool isEnable;
  final bool? i18n;

  final EdgeInsetsGeometry margin;
  final EdgeInsetsGeometry padding;

  final double height;
  final double radius;

  const MyBigButton({
    Key? key,
    required this.onPressed,
    this.child,
    this.text = "",
    this.size = 14,
    this.textColor,
    this.color,
    this.height = 36,
    this.radius = 6,
    this.margin = const EdgeInsets.only(top: 4,bottom: 4,left: 8,right: 8),
    this.padding =
        const EdgeInsets.only(top: 4,bottom: 4,left: 8,right: 8),
    this.isEnable = true,
    this.i18n,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Opacity(
      opacity: isEnable ? 1.0 : 0.5,
      child: MyInkWell(
        scaleDown: 0.95,
        //animation: MyInkWellAnimation.ink,
        child: Container(
          decoration: BoxDecoration(

            color: color ?? JmColors.main,
            borderRadius: BorderRadius.all(
              Radius.circular(radius),
            ),
          ),
          margin: margin,
          padding: padding,
          //width: double.infinity,
          height: height,
          alignment: Alignment.center,
          child: child ??
              MyText(
                text,
                color: textColor ?? Colors.white,
                size: size,
                weight: FontWeight.w500,
              ),
        ),
        onTap: isEnable ? onPressed : null,
      ),
    );
  }
}
